# !/usr/bin/env python
# encoding: utf-8
'''
  @author: HJW
  @license: (C) Copyright 2013-2017, Node Supply Chain Manager Corporation Limited.
  @contact: hejunwang01@126.com
  @file: testpage.py
  @time: 2022/7/10 0010 下午 18:25
  @desc:
  '''

# import pytest
# from ..elementpage.loginpage import LoginPage
# from ..basic.Page import BasePageObj
# import time
# from selenium import webdriver

# class test_Page:
#
#     @pytest.mark.parametrize([webdriver.Chrom(),"http://www.baidu.com","hejunwang","123456"])
#     def test_page_one(self,driver,url,username,passwd):
#         bp = BasePageObj(driver)
#         bp.open(url)
#         lp = LoginPage(driver)
#         lp.user_input(username)
#         lp.user_input(passwd)
#         bp.exit()
#


from selenium import webdriver
from selenium.webdriver.common.by import By

url = 'https://www.baidu.com'
# 使用headless无界面浏览器模式
chrome_options = webdriver.ChromeOptions()

chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--headless') #//增加无界面选项
chrome_options.add_argument('--disable-gpu') #//如果不加这个选项，有时定位会出现问题


browser = webdriver.Chrome(chrome_options=chrome_options)
browser.get(url)
kw1=browser.find_element(By.ID,'kw')
# kw2=browser.find_element_by_id('kw')
# kw3=browser.find_elements_by_id('kw')[0]
print(kw1)
# print(kw2)
# print(kw3)

browser.get_log('browser')#浏览器操作日志
browser.get_log('driver') #设备日志
# browser.get_log('client') #客户端日志
# browser.get_log('server')